﻿using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;

namespace Savage.DotNetLibrary.TestDotNetLibrary.ProtocolLibraryTests
{
    [TestFixture]
    public class TestGps
    {
        [Test]
        public void TestGpsPosition()
        {
            ProtocolLibrary.GPS.GPSPosition position = new ProtocolLibrary.GPS.GPSPosition(35, 20, 6.7558m, ProtocolLibrary.GPS.GPSReference.W);
            Assert.AreEqual(35, position.Degrees);
            Assert.AreEqual(20, position.Minutes);
            Assert.AreEqual(6.7558m, position.Seconds);

            Assert.AreEqual(-35.33521, Math.Round(position.ToDecimal(), 5));

            position.Degrees = 23;
            position.Minutes = 18;
            position.Seconds = 56.987m;
            position.Reference = ProtocolLibrary.GPS.GPSReference.S;

            Assert.AreEqual(23, position.Degrees);
            Assert.AreEqual(18, position.Minutes);
            Assert.AreEqual(56.987, position.Seconds);
            Assert.AreEqual(-23.31583, Math.Round(position.ToDecimal(), 5));
        }
    }
}
